//
//  HOMyMeterRecordViewController.m
//  微度报修
//
//  Created by foguo-mac-1 on 6/15/16.
//  Copyright © 2016 WeiDu. All rights reserved.
//

#import "HOMyMeterRecordViewController.h"
#import "HOMeterRecorderTableViewCell.h"
#import "HOMeterRecordEntity.h"

@interface HOMyMeterRecordViewController ()

@end

@implementation HOMyMeterRecordViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
	[self initTableView];
	[self initDataSource];
}

- (void)initDataSource
{
	for(int i = 0; i < 10; i ++)
	{
		HOMeterRecordEntity *entity = [[HOMeterRecordEntity alloc] init];
//		entity.meterNumber = 100.0;
		entity.meterAddress = @"保卫处保卫科保卫处保卫科保卫处保卫科保卫处保卫科保卫处保卫科保卫处保卫科";
		[self.tableViewDataList addObject:entity];
		[entity release];
	}
}

- (void)viewWillAppear:(BOOL)animated
{
	[super viewWillAppear:animated];
	[self setNavigationItemTitle:NSLocalizedString(@"我的抄表", @"我的抄表")];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - -- UITableViewDelegate/UITableViewDataResource implement methods
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 64;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
	NSInteger count = [self.tableViewDataList count];
	[self updateNoResultView:count];;
    return count;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}


- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return SECTION_PADDING / 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *HOMeterRecordEntityIdentifier = @"HOMeterRecordEntityIdentifier";
    HOMeterRecorderTableViewCell *cell = (HOMeterRecorderTableViewCell *)[tableView dequeueReusableCellWithIdentifier:HOMeterRecordEntityIdentifier];
    if(cell == nil)
	{
		cell = [[NSBundle mainBundle] loadNibNamed:@"HOMeterRecorderTableViewCell" owner:self options:nil][0];
    }
	cell.selectionStyle = UITableViewCellSelectionStyleNone;
	
	HOMeterRecordEntity *entity = [self.tableViewDataList objectAtIndex:indexPath.section];
//	cell.numberLbl.text = [NSString stringWithFormat:@"%0.02f", entity.meterNumber];
	cell.locationLbl.text = entity.meterAddress;
    return cell;
}

#pragma mark -- tool
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
